# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=barman
pkgver=3.10.0
pkgrel=1
pkgdesc="Backup and recovery manager for PostgreSQL"
url="https://pgbarman.org"
arch="noarch"
license="GPL-3.0-or-later"
depends="python3 rsync postgresql-client py3-argcomplete py3-dateutil py3-psycopg2 py3-boto3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-doc $pkgname-bash-completion $pkgname-pyc"
pkgusers="barman"
pkggroups="barman"
install="$pkgname.pre-install"
options="!check" #pytest does not start and I don't know why
checkdepends="py3-pytest-timeout py3-mock py3-pytest-runner py3-pip py3-mock"
source="$pkgname-$pkgver.tar.gz::https://github.com/EnterpriseDB/barman/releases/download/release/$pkgver/barman-$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	install -Dm0644 ./scripts/barman.bash_completion \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -d -o $pkgusers -g $pkggroups -m 755 "$pkgdir"/var/log/$pkgname

	cd doc
	install -Dm0644 barman.conf -t  "$pkgdir/etc"
}

sha512sums="
84bdd314ee336b1e0863f42be071927da6d333e9a31655a69444c9922310d78f03d1a2a64a36565dc4f3469a33b0d2286ece796aa22b760e97e0610ce51aed25  barman-3.10.0.tar.gz
"
